<include file="Public/head"/>
<body class="no-skin">
<include file="Public/header"/>
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            //ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>

    <include file="Public/sidebar"/>
	<div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            <include file="Public/breadcrumbs"/>

            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">
                <include file="Public/set"/>

                <!-- /section:settings.box -->
                <div class="row">
                    <div class="col-xs-12">
                <!-- PAGE CONTENT BEGINS -->

                <!--/span-->
                <!-- left menu ends -->
						<form style="margin-bottom:10px;" class="form-inline">
							<span id="date-range-picker">
								<div class="form-group">
									<div class="input-group date from-date-picker">
										<input type="text" class="form-control" name="start_date" value="{$start_date}" placeholder="开始日期">
										<span class="input-group-addon">
											<span class="glyphicon glyphicon-calendar ace-icon fa fa-calendar"></span>
										</span>
									</div>
								</div>
								<div class="form-group">
									<div class="input-group date to-date-picker">
										<input type="text" class="form-control" name="end_date" value="{$end_date}" placeholder="结束日期">
										<span class="input-group-addon">
											<span class="glyphicon glyphicon-calendar ace-icon fa fa-calendar"></span>
										</span>
									</div>
								</div>
							</span>
							<button type="submit" class="btn btn-primary" id="btn-search">查询</button>
						</form>

						<table class="table table-bordered table-hover table-striped">
							<thead>
							<tr>
								<th>提交时间</th>
								<th class="text-right">提现金额</th>
								<th class="text-center">状态</th>
								<th>备注</th>
							</tr>
							</thead>
							<tbody>
								<if condition="$data['count']==0">
								<tr>
									<td colspan="100">
										<div class="no-record">
											<i class="fa fa-inbox no-record-icon"></i>
											<div class="no-record-text">找不到相应的提现记录</div>
										</div>
									</td>
								</tr>
								<else/>
								<volist name="data.list" id="val">
								<tr>
									<td>
										<a href="{:U('withdraw_viwe',['id'=>$val['id']])}">{$val['create_time']}</a>
									</td>
									<td class="text-right">¥{$val['amount']}</td>
									<td class="text-center">
									<if condition="$val['status'] eq 1">
										<span class="hierarchy_default hierarchy_fine">已打款</span>
									<else/>
										<span class="hierarchy_default hierarchy_good">待打款</span>
									</if>
									</td>
									<td><if condition="$val['remarks'] eq ''">无<else/>{$val['remarks']}</if></td>
								</tr>
								</volist>
								</if>
							</tbody>
						</table>
                        <!-- PAGE CONTENT ENDS -->
                    </div>
                </div><!-- /.row -->
				{$page}
            </div><!-- /.page-content -->
        </div>
    </div><!-- /.main-content -->
	<include file="Public/footer"/>
</div><!-- /.main-container -->
<include file="Public/footerjs"/>
<script src="__PUBLIC__/qwadmin/js/date-time/bootstrap-datepicker.js"></script>
<script type="text/javascript">
	$(function () {
		$('.form-control').datepicker({
            format: 'yyyy-mm-dd',
            weekStart: 1,
            autoclose: true,
            todayBtn: 'linked',
            language: 'cn'
        });
		
		$('#btn-search').click(function () {
			search();
			return false;
		});
	});
	function search() {
		var start_date = $('input[name=start_date]').val();
		var end_date = $('input[name=end_date]').val();
		var startTime = new Date(Date.parse(start_date.replace(/-/g,   "/"))).getTime();  
		var endTime = new Date(Date.parse(end_date.replace(/-/g,   "/"))).getTime();    
		var dates = Math.abs((startTime - endTime))/(1000*60*60*24);	
		if (dates > 90) {
			layer.alert({
				title: '日期范围过大',
				message: '日期范围不能超过 90 天'
			});
			return false;
		}
		location.href = '{:U('withdraw_requests')}' + '/start_date/'+start_date+'/end_date/'+end_date;
	}
	</script>
</body>
</html>